package com.bw.zg3park2212.utils

import android.content.Context
import android.view.RoundedCorner
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bw.zg3park2212.R

object GlideUtils {
    fun loadImage(context: Context,url:String,imageView: ImageView){
        Glide.with(context).load(url)
            .placeholder(R.drawable.ic_launcher_background)
            .error(R.drawable.ic_launcher_foreground)
            .skipMemoryCache(true)
            .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
            .thumbnail(0.1f)
            .into(imageView)
    }
    fun loadYuanImage(context: Context,url:String,imageView: ImageView){
        Glide.with(context).load(url)
            .placeholder(R.drawable.ic_launcher_background)
            .error(R.drawable.ic_launcher_foreground)
            .skipMemoryCache(true)
            .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
            .thumbnail(0.1f)
            .circleCrop()
            .into(imageView)
    }
    fun loadJiaoImage(context: Context,url:String,imageView: ImageView){
        Glide.with(context).load(url)
            .placeholder(R.drawable.ic_launcher_background)
            .error(R.drawable.ic_launcher_foreground)
            .skipMemoryCache(true)
            .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
            .thumbnail(0.1f)
            .transform(CenterCrop(), RoundedCorners(25))
            .into(imageView)
    }
}